//
//  ApiCenter.h
//  Dermvpure
//
//  Created by <北京>杨硕 on 4/6/16.
//  Copyright © 2016 Dermvpure. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "BaseModel.h"
#import "BaseRequest.h"
#import "ErrorModel.h"
//#import "FileModel.h"

typedef void (^ApiCenterSuccessBlock)(BaseModel *model);
typedef void (^ApiCenterFailureBlock)(ErrorModel *model);
/*! 定义上传进度 block */
typedef void(^ApiUploadProgressBlock)(int64_t bytesProgress,
                                       int64_t totalBytesProgress);

@interface ApiCenter : NSObject

+ (ApiCenter *)defaultClient;

- (NSObject *)request:(BaseRequest *)request
          reponseType:(Class)type
              success:(ApiCenterSuccessBlock)success
              failure:(ApiCenterFailureBlock)failure;

/**
 *  上传图片
 */
- (void)uploadImageWithUrl:(NSString *)url params:(NSDictionary *)params image:(UIImage *)image uploadProgress:(void (^)(NSProgress * uploadProgress))upload success:(ApiCenterSuccessBlock)success failure:(ApiCenterFailureBlock)failure;
/**
 *  上传附件
 */
- (void)uploadFileWithUrl:(NSString *)url params:(NSDictionary *)params Filedata:(NSMutableArray *)fileDataArray uploadProgress:(void (^)(NSProgress * uploadProgress))upload success:(ApiCenterSuccessBlock)success failure:(ApiCenterFailureBlock)failure;



- (void)cancel:(NSObject *)task;

//- (void)postWithURLString:(NSString *)URLString
//               parameters:(id)parameters
//                  success:(void (^)(id))success
//                  failure:(void (^)(NSError *))failure;

- (void)postWithURLString:(NSString *)URLString
               parameters:(id)parameters
                  success:(void (^)(BaseModel *))success
                  failure:(void (^)(NSError *))failure;


/**
 获取应急办二级目录
 
 @param URLString 地址
 @param parameters 参数
 @param array 返回数据数组
 @param failure 失败的对象
 */
- (void)postEmengencyOfficeWithURLString:(NSString *)URLString
                              parameters:(id)parameters
                                 success:(void (^)(NSArray* arr))array
                                 failure:(void (^)(NSError * err))failure;

/**
 获取应急办三级目录
 
 @param URLString 地址
 @param parameters 参数
 @param array 返回数据数组
 @param failure 失败的对象
 */


- (void)postEmengencyPersonWithURLString:(NSString *)URLString
                              parameters:(id)parameters
                                 success:(void (^)(NSArray* arr))array
                                 failure:(void (^)(NSError * err))failure;
@end
